package ch4;


public class Animal {
	public String name;
	public Animal(String name){
		this.name = name;
	}
	
	public static void main(String [] args) {
		Animal a = new Animal("name");
		Cat c = new Cat("CatName", "Blue");
		Dog d = new Dog("Dogname", "black");
		
		System.out.println(a instanceof Animal);
		System.out.println(c instanceof Animal);
		System.out.println(d instanceof Animal);
		System.out.println(a instanceof Cat);
		
		a = new Dog("Dogname", "White");
		System.out.println(a.name);
		//System.out.println(a.furColor);
		System.out.println(a instanceof Animal);
		System.out.println(a instanceof Dog);
		Dog d2 = (Dog)a;
		System.out.println(d2.furColor);
		Cat c2;
		if(a instanceof Cat) {
			c2 = (Cat)a;
			System.out.println(c2.eyeColor);
		}
		//Cat c2 = (Cat)a;
		//System.out.println(c2.eyeColor);
		
	}
}

